package com.shuoyue.ycgk.ui.questionbank.reportwrong;

import com.shuoyue.ycgk.base.BasePresenter;
import com.shuoyue.ycgk.base.BaseResult;
import com.shuoyue.ycgk.base.BaseView;
import com.shuoyue.ycgk.entity.QuestionSimple;
import com.shuoyue.ycgk.net.RetrofitClient;
import com.shuoyue.ycgk.net.base.ApiSubscriber;
import com.shuoyue.ycgk.net.gsondefaultadapter.Optional;

import io.reactivex.Observable;
import retrofit2.http.Field;

public interface ReportWrongContract {
    interface View extends BaseView {
        void reportSuc();
    }

    class Presenter extends BasePresenter<View> {
        Model model = new Model();

        public void feedback(
                Integer type,
                Integer subtype,
                String content,
                Integer objId) {
            apply(model.feedback(subtype,
                    type,
                    content,
                    objId))
                    .subscribe(new ApiSubscriber<Optional<String>>(mView, this) {
                        @Override
                        public void onNext(Optional<String> dayTagetOptional) {
                            super.onNext(dayTagetOptional);
                            mView.reportSuc();
                        }
                    });
        }
    }

    class Model {

        /**
         * * subtype: 1
         * * type: 1
         * * content: 1111
         * * objId: 192357
         *
         * @return
         */
        Observable<BaseResult<String>> feedback(Integer subtype,
                                                Integer type,
                                                String content,
                                                Integer objId) {
            return RetrofitClient.getInstance().getApi().feedback(subtype,
                    type,
                    content,
                    objId);
        }

    }
}
